<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Music extends MY_Controller{

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/home
	 *	- or -  
	 * 		http://example.com/index.php/home/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
    function __construct()
    {
        parent::__construct();

		//Set Target Asset Url
		$this->config->set_item('base_asset_url', $this->config->item('base_video_asset_url'));
				
		//Google Analytics ID
		$this->data['ga_id'] = 11;		
		
		//Load model
		$this->load->model('music_model');
				
		//Load Music Script
		$this->data['js'][] = "musicScript.js";
		$this->data['css'][] = "musicStyle.css";
		
		 //Load Library
  		$this->load->library('pagination');
		
		//Load Top Sub Menu
		$this->data['top_sub_menu'] = $this->top_sub_menu();		
    }
	
	/*Top Menu*/
	private function top_sub_menu()
	{
		//Filter Type
		$this->data['type'] = $this->uri->segment(1);
		if(!in_array($this->data['type'],array('new_released','recommend','hit','dreamticket'))) $this->data['type'] = "new_released";
		//Filter Media Type
		switch($this->uri->segment(2)):
			case 'thai':
				$this->data['media_type'] = 'thai';
				$this->data['media_type_text'] = 'เพลงไทย';
			break;
			case 'inter':
				$this->data['media_type'] = 'inter';
				$this->data['media_type_text'] = 'เพลงสากล';
			break;
			case 'asian':
				$this->data['media_type'] = 'asian';
				$this->data['media_type_text'] = 'เพลงเอเชียน';
			break;
			default:
				$this->data['media_type'] = 'all';
				$this->data['media_type_text'] = 'เพลงทั้งหมด';
		endswitch;
		//Filter Genre
		$this->data['genre'] = $this->uri->segment(3);
		$is_exist = $this->db->from('genre')->where(array('genre_alias' => ''.$this->data['genre'].''))->count_all_results();
		if(!empty($is_exist)):
			$dataGenre = $this->db->select('genre_name')->get_where('genre',array('genre_alias' => $this->data['genre']))->row();
			$this->data['genre_text'] = $dataGenre->genre_name;				
		else:
			$this->data['genre'] = "all";	
			$this->data['genre_text'] = "แนวเพลงทั้งหมด";			
		endif;
		
		$this->data['dataGenre'] = $this->db
		->order_by('genre_name ASC')
		->get('genre')
		->result();		
			
		return $this->load->view($this->router->class."/top_sub_menu",$this->data, TRUE);
	}	
	
	/* module album*/
	private function album_review(){
		$this->memcache->delete('dataAlbumReview');
		if ( !$dataAlbumReview = $this->memcache->get('dataAlbumReview')):
			$dataAlbumReview = $this->db->select('t.news_id,t.views,j.news_subject')
			->join('news_info as j','j.news_id=t.news_id','INNER')
			->order_by('t.news_publish_date','DESC')
			->get_where('news as t',"t.news_type_id = 5 AND t.is_review_hilight = '1' AND t.is_publish = '1'",20)
			->result();	
			foreach($dataAlbumReview as $value):
				$value->image = $this->db->order_by("news_image_order ASC,news_image_id ASC")->get_where('news_image',array('news_id' => $value->news_id),1)->row();
			endforeach;
			$this->memcache->set('dataAlbumReview', $dataAlbumReview, $this->memcache_time);
		endif;
		return $dataAlbumReview;
	}
	
	/*Home*/	 
	public function index()
	{	
		if($this->input->post('ajax')) $this->ajax_music_pager('Search',TRUE);
		
		//Load Javascript
		$this->data['js'][] = "jquery.multipleelements.cycle.min.js";	
				
		//Load Module
		$this->data['module'] = $this->module('music');	
		
		//Load Album Review		
		$this->data['dataAlbumReview'] = $this->album_review();
		
		//$this->data['dataSongInfo'] = "";
		if(!intval($this->input->get('p'))):
			if ( !$this->data['dataSongList'] = $this->memcache->get('dataSongNewRelease')):
				$this->data['dataSongList'] = $this->ajax_music_pager('Search');
				//Cache Set
				$this->memcache->set('dataSongNewRelease', $this->data['dataSongList'], $this->memcache_time);		
			endif;
		else:
			$this->data['dataSongList'] = $this->ajax_music_pager('Search');
		endif;
		
		$this->data['content'] = $this->router->class."/index";
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
		
		
	}	
	
	private function ajax_music_pager($mode,$ajax = FALSE)
	{
		switch($mode):
			case 'Search':
				$text = $this->input->get('text');
				$letter = $this->input->get('letter');
				$per_page = 32;
				$searchCondition = "t.is_publish = '1' AND (t.song_publish_date IS NULL OR t.song_publish_date < NOW())";
				if(!empty($letter)):
					if($letter == "other_thai"):
						$searchCondition.= " AND t.letters = '#' AND t.media_type_id = 1";
					elseif($letter == "other_eng"):
						$searchCondition.= " AND t.letters = '#' AND t.media_type_id IN (2,3)";
					else:
						$searchCondition.= " AND t.letters = '".$letter."'";
					endif;
				endif;
				if(!empty($text)):
					$searchCondition.= " AND j.song_name LIKE '%".$text."%'";
				endif;  
				$order_by = "t.song_publish_date DESC,t.song_id DESC";
			break;
			case 'Filter':
				$per_page = 32;
				$type = $this->uri->segment(1);
				$media_type = $this->uri->segment(2);
				$genre = $this->uri->segment(3);
				$language = $this->uri->segment(4);
				$alphabet = $this->uri->segment(5);
				$searchCondition = "t.is_publish = '1' AND (t.song_publish_date IS NULL OR t.song_publish_date < NOW())";
				$order_by = "";
				if(!empty($type)) switch($type):	
					case 'new_released':
						$order_by .= "t.song_publish_date DESC,t.song_id DESC";
					break;			
					case 'hit':
						$searchCondition .= " AND DATE(t.song_publish_date) >= DATE_SUB(CURDATE(),INTERVAL 1 MONTH)";
						$order_by = "t.views DESC";
					break;
					case 'recommend':
						$searchCondition .= " AND is_show_recommend = '1'";
						$order_by = "t.song_publish_date DESC,t.song_id DESC";
					break;
					case 'dreamticket':
						$searchCondition .= " AND `t`.`song_id` IN (SELECT song_id FROM oni_artist as x INNER JOIN oni_song_artist as y ON (`y`.`artist_id`=`x`.`artist_id`) WHERE `x`.`is_show_dream_ticket`='1')";
						$order_by = "t.song_publish_date DESC,t.song_id DESC";
					break;														
				endswitch;
				if(!empty($media_type) && $media_type != "all"): 
					switch($media_type):	
						case 'thai':
							$searchCondition .= " AND t.media_type_id = 1";
						break;			
						case 'inter':
							$searchCondition .= " AND t.media_type_id = 2";
						break;
						case 'asian':
							$searchCondition .= " AND t.media_type_id = 3";
						break;					
					endswitch;
				endif;
				if(!empty($genre) && $genre != "all"):
					$is_exist = $this->db->from('genre')->where(array('genre_alias' => $genre))->count_all_results();
					if(empty($is_exist)) $this->page_missing();
					$searchCondition .= " AND l.genre_alias = '".$genre."'";
				endif;
				if(!empty($language) && !empty($alphabet)):
					if($alphabet == "other") $alphabet = "#";
					if($language == "e" && $media_type == "thai"):
						$searchCondition = "t.is_publish = '1' AND (t.media_type_id = 2 OR t.media_type_id = 3) AND t.letters = '".$alphabet."'";
					elseif($language == "t" && ($media_type == "inter" || $media_type == "asian")):
						$searchCondition = "t.is_publish = '1' AND t.media_type_id = 1 AND t.letters = '".$alphabet."'";
					else:
						$searchCondition .= " AND t.letters = '".urldecode($alphabet)."'";
					endif;
				endif;		
			break;
		endswitch;
				
		$config['base_url'] = current_url().'?'.query_string(array('p'));
		$config['total_rows'] = $this->db->select('COUNT(DISTINCT(t.song_id)) as Total')
		->join('song_genre as k','k.song_id=t.song_id','INNER')
		->join('genre as l','l.genre_id = k.genre_id','INNER')		
		->join('song_info as j',"j.song_id=t.song_id",'INNER')
		->get_where('song as t',$searchCondition)
		->row()->Total;
	   	$config['per_page'] = $per_page;
	   	$config['num_links'] = 5;
		$config['first_link'] = '<span class="arrows first ">&laquo;</span>';
  		$config['next_link'] = '<span class="arrows next ">&gt;</span>';
  		$config['prev_link'] = '<span class="arrows prev ">&lt;</span>';
  		$config['last_link'] = '<span class="arrows last ">&raquo;</span>';
		$config['page_query_string'] = TRUE;
		$config['query_string_segment'] = 'p';
		$this->pagination->initialize($config);
		$this->data['pager'] = $this->pagination->create_links();
	
		$this->data['dataSongList'] = $this->db->select('t.song_id,j.song_name,t.views')
		->join('song_genre as k','k.song_id=t.song_id','INNER')
		->join('genre as l','l.genre_id = k.genre_id','INNER')			
		->join('song_info as j',"j.song_id=t.song_id",'INNER')
		->order_by($order_by)
		->group_by('t.song_id')		
		->get_where('song as t',$searchCondition,$config['per_page'],intval($this->input->get('p')))->
		result();
		foreach($this->data['dataSongList'] as $value):
			$value->artist = $this->db->select('j.artist_id,j.artist_name')
			->join('artist_info as j','j.artist_id=t.artist_id','INNER')
			->get_where('song_artist as t',array('t.song_id' => $value->song_id,'t.is_default' => '1'))
			->result();
				
			$value->album = $this->db->select('j.album_id,j.album_file_name,j.album_file_ext')
			->join('album_info as j','j.album_id=t.album_id','INNER')
			->get_where('song_album as t',array('t.song_id' => $value->song_id,'t.is_default' => '1'),1)
			->row();
		endforeach;

		if($ajax):
			echo $this->load->view($this->router->class."/ajax_music_pager", $this->data, TRUE);
			exit;
		else:
			return $this->load->view($this->router->class."/ajax_music_pager", $this->data, TRUE);		
		endif;		
	}

	public function new_released(){$this->filter('new_released');}
	public function hit(){$this->filter('hit');}
	public function recommend(){$this->filter('recommend');}
	public function dreamticket(){$this->filter('dreamticket');}
	private function filter($type = NULL)
	{
		//Load Javascript
		$this->data['js'][] = "jquery.multipleelements.cycle.min.js";	
				
		//Load Module
		$this->data['module'] = $this->module('music');
		
		//Load Album Review		
		$this->data['dataAlbumReview'] = $this->album_review();	
		
		$type = $this->uri->segment(1);
		$media_type = $this->uri->segment(2);
		$genre = $this->uri->segment(3);
		$language = $this->uri->segment(4);
		$alphabet = $this->uri->segment(5);
		switch($type):
			case 'new_released':
				if(!intval($this->input->get('p')) && $media_type == 'all' && $genre == 'all' && $language == NULL && $alphabet == NULL):
					if ( !$this->data['dataSongList'] = $this->memcache->get('dataSongNewRelease')):
						$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
						//Cache Set
						$this->memcache->set('dataSongNewRelease', $this->data['dataSongList'], $this->memcache_time);		
					endif;		
				else:
					$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
				endif;	
				
				//Set SEO Tag
				$this->data['seo_title'] = 'เพลงใหม่ | ฟังเพลงใหม่ You2Play.com';
				$this->data['seo_keyword'] = 'เพลงใหม่, ฟังเพลงใหม่, ฟังเพลง, ฟังเพลงออนไลน์';
				
				//GA Events
				$this->data['ga_event'] = 'CI-'."new_released";						
			break;
			case 'hit':
				if(!intval($this->input->get('p')) && $media_type == 'all' && $genre == 'all' && $language == NULL && $alphabet == NULL):
					if ( !$this->data['dataSongList'] = $this->memcache->get('dataSongHit')):
						$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
						//Cache Set
						$this->memcache->set('dataSongHit', $this->data['dataSongList'], $this->memcache_time);		
					endif;		
				else:
					$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
				endif;
				
				//Set SEO Tag
				$this->data['seo_title'] = 'เพลงฮิต | ฟังเพลงฮิต You2Play.com';
				$this->data['seo_keyword'] = 'เพลงฮิต, ฟังเพลงฮิต, ฟังเพลง, ฟังเพลงออนไลน์';
				
				//GA Events
				$this->data['ga_event'] = 'CI-'."hit";							
			break;
			case 'recommend':
				if(!intval($this->input->get('p')) && $media_type == 'all' && $genre == 'all' && $language == NULL && $alphabet == NULL):
					if ( !$this->data['dataSongList'] = $this->memcache->get('dataSongRecommend')):
						$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
						//Cache Set
						$this->memcache->set('dataSongRecommend', $this->data['dataSongList'], $this->memcache_time);		
					endif;		
				else:
					$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
				endif;
			
				//Set SEO Tag
				$this->data['seo_title'] = 'เพลงแนะนำ | ฟังเพลงแนะนำ You2Play.com';
				$this->data['seo_keyword'] = 'เพลงแนะนำ, ฟังเพลงแนะนำ, ฟังเพลง, ฟังเพลงออนไลน์';
				
				//GA Events
				$this->data['ga_event'] = 'CI-'."recommend";								
			break;
			case 'dreamticket':
				if(!intval($this->input->get('p')) && $media_type == 'all' && $genre == 'all' && $language == NULL && $alphabet == NULL):
					if ( !$this->data['dataSongList'] = $this->memcache->get('dataSongDreamTicket')):
						$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
						//Cache Set
						$this->memcache->set('dataSongDreamTicket', $this->data['dataSongList'], $this->memcache_time);		
					endif;		
				else:
					$this->data['dataSongList'] = $this->ajax_music_pager('Filter');
				endif;
			
				//Set SEO Tag
				$this->data['seo_title'] = 'DreamTicket แหล่งรวมผลงานศิลปินหน้าใหม่| ศิลปินอินดี้ You2Play.com';
				$this->data['seo_keyword'] = 'ศิลปืนอินดี้, ฟังเพลงอินดี้, อินดี้, ฟังเพลง, ฟังเพลงออนไลน์';
				
				//GA Events
				$this->data['ga_event'] = 'CI-'."dreamticket";								
			break;								
		endswitch;
				
		$this->data['content'] = $this->router->class."/filter";
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
	}

	/*Play Music*/
	public function play($id = NULL,$seo_text = NULL)
	{
		$is_exist = $this->db->from('song')->where(array('song_id' => $id,'is_publish' => '1'))->count_all_results();
		if(empty($is_exist)) $this->page_missing();
		
		//Rediect if no seo text
		if(empty($seo_text)):
			$dataResult = $this->db->get_where('song_info',array('song_id' => $id),1)->row();
			redirect($music_url.'play/'.intval($id).'-'.seo_url($dataResult->song_name), 'location', 301);
		endif;
		
		//Load Javascript
		$this->data['js'][] = "jquery.multipleelements.cycle.min.js";
		$this->data['js'][] = "ZeroClipboard/ZeroClipboard.js";
		
		//Load Media Player
		if(!$this->agent->is_mobile()):
			$this->data['js'][] = "media/jwplayerx.js";
		endif;	
				
		//Load Module
		$this->data['module'] = $this->module('music');
		$this->data['module_facebook_plugins_share'] = $this->module_facebook_plugins_share();
		$this->data['module_facebook_plugins_comment'] = $this->module_facebook_plugins_comment();
		
		//Load Ads
/*		$this->data['dataAds'] = array();
		$dataAds = $this->db->select('ads_id,ads_vast,ads_weight,limit_per_day')
		->get_where('ads',"start_date <= '".date('Y-m-d H:i:s')."' AND end_date > '".date('Y-m-d H:i:s')."' AND (ads_impression = 0 OR ads_impression > views) AND is_music = '1'")
		->result();
		foreach($dataAds as $key => $value):
			if(!empty($value->limit_per_day)):
				$impression_today = intval($this->db->select('SUM(views) as Views')
				->get_where('ads_static',"ads_id = ".$value->ads_id." AND event = 'Impression' AND DATE(date) = '".date('Y-m-d')."'")->row()->Views);
				if($impression_today < $value->limit_per_day):
					$this->data['dataAds'][] = $value;
				endif;			
			else:
				$this->data['dataAds'][] = $value;
			endif;
		endforeach;*/
		
		//Set Solr Seach
		$searchSolrSong = "";				
				
		$this->data['dataResult'] = $this->db->select('t.song_id,t.rate_score,t.views,t.create_date,j.song_name,j.song_file_name,j.song_file_ext,j.song_description,j.song_lyrics,j.genre_tag,j.song_tag,j.song_embed,k.chords_id')
		->join('song_info as j','j.song_id=t.song_id','INNER')
		->join('chords as k','k.song_id=t.song_id','LEFT')
		->get_where('song as t',array('t.song_id' => $id,'t.is_publish' => '1'),1)
		->row();
		
		//Check Autoplay && Tranparent to Embed 
		if(!empty($this->data['dataResult']->song_embed)) $this->data['dataResult']->song_embed = preg_replace('/src=\"(.+?)(\?autoplay=1|)\"/','src="$1?autoplay=1&wmode=transparent"',$this->data['dataResult']->song_embed);
				
		//High Algorythm
		$dataArtist = $this->db->select('j.artist_id,j.artist_name')
		->join('artist_info as j','j.artist_id=t.artist_id','INNER')
		->get_where('song_artist as t',array('t.song_id' => $this->data['dataResult']->song_id,'is_default' => '1'))
		->result();
		$this->data['dataResult']->artist = array();
		foreach($dataArtist as $artist):
			$this->data['dataResult']->artist[] = array(
				'artist_id' => $artist->artist_id,
				'artist_name' => $artist->artist_name
			);
			
			//Solr Search Artist
			$searchSolrSong .= 'artist_id_i_arr:'.$artist->artist_id.' OR ';
		endforeach;
		$this->data['dataResult']->album = $this->db->select('j.album_id,j.album_name,j.album_file_name,j.album_file_ext')
		->join('album_info as j','j.album_id=t.album_id','INNER')
		->get_where('song_album as t',array('t.song_id' => $this->data['dataResult']->song_id,'is_default' => '1'),1)
		->row();	
		//Solr Search Album
		if(!empty($this->data['dataResult']->album)) $searchSolrSong .= 'album_id_i_arr:'.$this->data['dataResult']->album->album_id.' OR ';
		if(!empty($searchSolrSong)):
			$searchSolrSong = 'id:song_* AND last_modified:[* TO '.date("Y-m-d\TH:i:s\Z",time()).'] AND ('.rtrim($searchSolrSong,' OR ').')';	
		else:
			$searchSolrSong = 'id:song_* AND last_modified:[* TO '.date("Y-m-d\TH:i:s\Z",time()).']';
		endif;
		
		//Total Song Click Rate
		$this->data['dataResult']->song_rate_all = @$this->db->from('song_rating')
		->where(array('song_id' => $id))
		->count_all_results();
		
		//Valid Review Song
		$is_exist = $this->db->from('news as t')
		->join('news_info as j','j.news_id=t.news_id','INNER')
		->where("t.news_type_id = 5 AND j.news_relate LIKE '%\"module\":\"Song\",\"value\":\"".$id."\"%'")
		->count_all_results();
		if(!empty($is_exist)):
			$this->data['dataSongReview'] = $this->db->select('t.news_id,j.news_subject')
			->join('news_info as j','j.news_id=t.news_id','INNER')
			->get_where('news as t',"t.news_type_id = 5 AND j.news_relate LIKE '%\"module\":\"Song\",\"value\":\"".$id."\"%'",1)
			->row();
		endif;
		
		//Load Library
		$this->load->library('solr');

		$this->data['dataSongRelate'] = $this->solr->query($searchSolrSong)->limit(9)->order_by(array('last_modified' => 'DESC'))->result();
		if(count($this->data['dataSongRelate']) == 0):
			$searchSolrSong = 'id:song_*';
			$this->data['dataSongRelate'] = $this->solr->query($searchSolrSong)->limit(9)->order_by(array('last_modified' => 'DESC'))->result();
		endif;
		foreach($this->data['dataSongRelate'] as $value):
			/*Get Artist Info*/
			if(!empty($value->artist_id_i_arr)):
				$artistQuery = '';
				if(is_array($value->artist_id_i_arr)):
					foreach($value->artist_id_i_arr as $artist_id):
						$artistQuery .= 'id:artist_'.$artist_id.' OR ';
					endforeach;
					$artistQuery = rtrim($artistQuery,' OR ');
				else:
					$artistQuery = 'id:artist_'.$value->artist_id_i_arr;
				endif;
				$value->artist = $this->solr->query($artistQuery)->result();
			endif;
			/*Get Album Info*/
			if(!empty($value->album_id_i_arr)):
				$albumQuery = '';
				if(is_array($value->album_id_i_arr)):
					foreach($value->album_id_i_arr as $album_id):
						$albumQuery .= 'id:album_'.$album_id.' OR ';
					endforeach;
					$albumQuery = rtrim($artistQuery,' OR ');
				else:
					$albumQuery = 'id:album_'.$value->album_id_i_arr;
				endif;
				$value->album = $this->solr->query($albumQuery)->row();
			endif;			
		endforeach;
		
		//Set SEO Tag
		$this->data['seo_title'] = ''.$this->data['dataResult']->song_name.(!empty($this->data['dataResult']->artist) ? ' - '.$this->data['dataResult']->artist{0}['artist_name']:'').' | ฟังเพลง ฟังเพลงออนไลน์ You2Play.com';
		$this->data['seo_description'] = 'เพลง '.$this->data['dataResult']->song_name.(!empty($this->data['dataResult']->artist) ? ' - '.$this->data['dataResult']->artist{0}['artist_name']:'').' '.$this->data['seo_description'];
		$this->data['seo_keyword'] = ($this->data['dataResult']->song_tag ? rtrim($this->data['dataResult']->song_tag,','):'').', ฟังเพลง, ฟังเพลงออนไลน์, เพลงไทย, เพลงต่างประเทศ, เพลงเอเชียน';	
		
		$this->data['fb_title'] = $this->data['seo_title'];
		if(!empty($this->data['dataResult']->album)) $this->data['fb_image'] = image_asset_url('../uploads/album/images/120x120/'.$this->data['dataResult']->album->album_file_name.'.'.$this->data['dataResult']->album->album_file_ext);
		if(!empty($this->data['dataResult']->song_embed)):
			if(preg_match('/\/embed\/(.+?)\"/',$this->data['dataResult']->song_embed,$matches)):
				$this->data['fb_media'] = 'http://www.youtube.com/v/'.$matches[1].'?version=3&amp;autohide=1';
			endif;				
		else:
			$image_file = "";
			if(!empty($this->data['dataResult']->album)) $image_file = image_asset_url('../uploads/album/images/original/'.$this->data['dataResult']->album->album_file_name.'.'.$this->data['dataResult']->album->album_file_ext);		
			$media_file = other_asset_url('uploads/song/files/'.date('Y/m/d',strtotime($this->data['dataResult']->create_date)).'/'.$this->data['dataResult']->song_file_name.'.'.$this->data['dataResult']->song_file_ext);
			$this->data['fb_media'] = 'http://static.you2play.com/2013/assets/js/media/player.swf?file='.$media_file.'&image='.$image_file.'&autostart=true';
		endif;
		$this->data['fb_type'] = 'music.song';
		
		//GA Events
		$this->data['ga_event'] = 'CI-'.$id.'-'.seo_url($this->data['dataResult']->song_name);
			
		$this->data['content'] = $this->router->class."/play";
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
	}
	
	/*Search*/
	public function search()
	{	
		//Load Module
		$this->data['module'] = $this->module('music');			
		
		//Chords Search
		$this->data['dataSongList'] = $this->ajax_music_pager('Search');		
		
		$this->data['content'] = $this->router->class."/filter";
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);		
	}	

	/*Ajax View Song*/
	public function ajax_view_song()
	{
		$this->music_model->ajax_view_song();
	}
	
	/*Ajax Vote Song*/
	public function ajax_vote_song()
	{
		$this->music_model->ajax_vote_song();
	}
	
	/*Ajax Copy Stat*/
	public function ajax_copy_stat()
	{
		$this->music_model->ajax_copy_stat();
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */